﻿<%@ WebHandler Language="C#" Class="InterfaceProcess" %>

using System;
using System.Text;
using System.Web;
using ChBusiness.Wsbs;
using ExtBusiness.Common;
using ExtBusiness.WepPost;
using ExtBusiness.Model;

public class InterfaceProcess : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        var tocken = context.Request["tocken"];
        var userId = context.Request["userID"];
        var userName = context.Request["userName"];
        var tableId = context.Request["tableID"];
        context.Response.ContentType = "text/plain";
        context.Response.Write(GetXmlData(tocken, userId, userName, tableId));
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

    private string GetXmlData(string tocken, string userId, string userName, string tableId)
    {
        const string apiUrl = "http://www.webmap.cn/mapDataAction.do?method=forwSecret&tocken=?&userID=?&userName=?&tableID=?";
        string respJson;
        WebPostHelper.Response(string.Empty, apiUrl, out respJson);
        //var model = respJson.Json2T<ExtBusiness.Model>();

        var builder = new StringBuilder();
        builder.Append("<recordinfo>");
        builder.AppendFormat("<trans><url>{0}</url>", "http://124.207.179.252/gcweb/wsbs/ShenBaoNew.aspx?flowname=国家涉密基础测绘成果使用申报&iid=12016101900095&flowtype=国家涉密基础测绘成果资料提供使用审批&type=3&DialogFlag=&flag=");
        builder.AppendFormat("<userid>{0}</userid>", "danwei");
        builder.AppendFormat("<iid>{0}</iid></trans>", "12016101900095");
        builder.Append("</recordinfo>");
        return builder.ToString();
        //var path = "http://api.thinkpage.cn/v3/weather/now.json?key=vvpx9qv6t0dqa46s&location=beijing&language=zh-Hans&unit=c";
        //var reqJson = string.Empty;
        //string respJson;
        //WebPostHelper.Response(reqJson, path, out respJson);
        //return respJson;
        //return SerialInstance.Instance.GetApprovalResult("123456");
    }
}